home *** CD-ROM | disk | FTP | other *** search
- /*
- File: ShowAllMountedVolumeNames.c
-
- Contains:
-
- Written by: Martin Minow
-
- Copyright: Copyright © 1992-1999 by Apple Computer, Inc., All Rights Reserved.
-
- You may incorporate this Apple sample source code into your program(s) without
- restriction. This Apple sample source code has been provided "AS IS" and the
- responsibility for its operation is yours. You are not permitted to redistribute
- this Apple sample source code as "Apple sample source code" after having made
- changes. If you're going to re-distribute the source, we require that you make
- it clear in the source that the code was descended from Apple sample source
- code, but that you've made changes.
-
- Change History (most recent first):
- 7/14/1999 Karl Groethe Updated for Metrowerks Codewarror Pro 2.1
-
-
- */
-
- #include <stdio.h>
- #include <Files.h>
- #include <Devices.h>
- #ifndef FALSE
- #define FALSE 0
- #define TRUE 1
- #endif
-
- void ShowAllMountedVolumeNames(void);
- void ShowSCSIDeviceIdent(
- short driverRefNum
- );
-
- void
- ShowAllMountedVolumeNames(void)
- {
- short index;
- OSErr status;
- HVolumeParam pb;
- Str255 volumeName;
-
-
- for (status = noErr, index = 1;; index++) {
- pb.ioCompletion = NULL;
- pb.ioVolIndex = index;
- volumeName[0] = 0;
- pb.ioNamePtr = volumeName;
- pb.ioVRefNum = 0;
- status = PBHGetVInfo((HParmBlkPtr) &pb, FALSE); /* Synchronous */
- if (status != noErr)
- break;
- /*
- * Display the drive number, driver number, and volume name.
- */
- printf("Drive %2d, driver %3d, \"%.*s\"",
- (int) pb.ioVDrvInfo,
- (int) pb.ioVDRefNum,
- volumeName[0], &volumeName[1]
- );
- ShowSCSIDeviceIdent(pb.ioVDRefNum);
- printf("\n");
- }
- }
-